This is a visual inspection script to look at Metals data from the sed traps. In the final EDI publication we also include Carbon and Nitrogen fluxes.
This script reads in the metals data. Checks if there are any NAs in the flag columns. The creates QAQC plots. These plots are time series of the fluxes along with cumulative mass plots. See below for more details on the plots.
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document.
This section checks to make sure each observation has a data flag. It also checks to make sure the frequency of flags match what we expect to see.
## Flag_CombinedCollectionVol_L
## 1 2 3 <NA>
## 443 11 63 0
## Flag_Filter2ID
## 1 2 <NA>
## 506 11 0
## Flag_CombinedSedMass_g
## 1 2 <NA>
## 506 11 0
## Flag_ICPTLi_mgL
## 1 <NA>
## 517 0
## Flag_ICPTNa_mgL
## 1 <NA>
## 517 0
## Flag_ICPTMg_mgL
## 1 <NA>
## 517 0
## Flag_ICPTAl_mgL
## 1 <NA>
## 517 0
## Flag_ICPTSi_mgL
## 1 <NA>
## 517 0
## Flag_ICPTK_mgL
## 1 <NA>
## 517 0
## Flag_ICPTCa_mgL
## 1 <NA>
## 517 0
## Flag_ICPTFe_mgL
## 1 <NA>
## 517 0
## Flag_ICPTMn_mgL
## 1 <NA>
## 517 0
## Flag_ICPTCu_mgL
## 1 <NA>
## 517 0
## Flag_ICPTSr_mgL
## 1 <NA>
## 517 0
## Flag_ICPTBa_mgL
## 1 <NA>
## 517 0
For the plots, they use a function called “cum_mass_plot”. The function is created in this Markdown document. In cum_mass_plot you can specify if you want plotly plots for the flux data. For right now you can specify which plotly plots you want on. You can also look at the plotly plots manually in each chunk by running the chunk with use_plotly=TRUE as an argument and then at the end of the chunk output[[1]].
The plotting function is called cum_mass_plot() which plots the 3 plots described below. The arguments are: data_flux, # name of the data frame for fluxes, which needs to be in quotes, data_mass, # name of the data frame for cumulative mass, which needs to be in quotes, y_var_flux, # name of the col in the flux df where the data are in quotes y_var_mass, # name of the col in the mass df element_name, # full name of the element for the title current_year, # current year that we want to take a closer look at use_plotly) # Do we want to make the plots interactive? = T
The plots below are: The first 2 plots are the ones you should focus on for the QAQC check. Spend the most time looking at the most recent data because that one has not been checked. Do pay attention to the historical to make sure there are no crazy outliers that were missed in previous years. There is an option to include heatmaps. Once note with heat
A time series of the current years’ data that has been qaqced. Make sure noting was missed in the script or that need to be added to the maintenance log. In addition to the timeseries, there is a timeseries but each depth is on its own plot. This is only if there are more than one depth in the data frame. There is also an option for a heatmap. Make sure you have multiple depths in your data and that Heatmap=T is an argument in the function. Heat maps observations are interpolated so I would use this plots caution. If you find something off in the heatmap then look at the actual observation in the timeseries.
A time series of the historical and the current data just the qaqced values. Just as the current years’ data there is also a timeseries split by depth and an option for a heatmap.
The next two plots are just fun to see trends over time with the data.